Previous Book Contents Book Index Next

Inside Macintosh: Mac OS 8 Toolbox Reference /
Chapter 2 - Control Manager Reference / Control Manager Functions
Defining Your Own Action Functions /


MyActionProc

CHANGED WITH THE APPEARANCE MANAGER

Defines actions to be performed repeatedly in response to a mouse-down event in a control part.

The Control Manager declares the type for an application-defined action function as follows:

typedef pascal void (*ControlActionProcPtr)(
                              ControlHandle theControl, 
                              ControlPartCode partCode);
The Control Manager defines the data type ControlActionUPP to identify the universal procedure pointer for this application-defined function:

typedef UniversalProcPtr ControlActionUPP;
You typically use the NewControlActionProc macro like this:

ControlActionUPP myActionUPP;
myActionUPP = NewControlActionProc(MyAction);

You typically use the CallControlActionProc macro like this:

CallControlActionProc(MyActionUPP, theControl, partCode);

Here's how to declare an action function for a control part if you were to name the function MyActionProc:

pascal void MyActionProc (
                     ControlHandle theControl,
                     ControlPartCode partCode);
theControl
A handle to the control in which the mouse-down event occurred.
partCode
A control part code; see "Control Part Code Constants". When the cursor is still in the control part where the mouse-down event first occurred, this parameter contains that control's part code. When the user drags the cursor outside the original control part, this parameter contains 0.
DISCUSSION
When a mouse-down event occurs in a control, HandleControlClick and TrackControl respond as is appropriate by highlighting the control or dragging the indicator as long as the user holds down the mouse button. You can define other actions to be performed repeatedly during this interval. To do so, define your own action function and point to it in the actionProc parameter of the TrackControl function or the inAction parameter of HandleControlClick. This is the only way to specify actions in response to all mouse-down events in a control or indicator.

IMPORTANT
You should use the MyIndicatorActionProc function while tracking indicators of controls that don't support live feedback.
SEE ALSO
SetControlAction.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
8 JAN 1998